package gsw.demo;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import gsw.demo.socket.ActivitySocket;
import gsw.demo.toolhttp.ActivityToolHttp;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        init();
    }

    private void init() {
        View.OnClickListener clickListener = new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (v.getId() == R.id.openSocket) {
                    Intent i = new Intent(MainActivity.this, ActivitySocket.class);
                    startActivity(i);
                } else if (v.getId() == R.id.opentoolhttp) {
                    Intent i = new Intent(MainActivity.this, ActivityToolHttp.class);
                    startActivity(i);
                }
            }
        };
        findViewById(R.id.openSocket).setOnClickListener(clickListener);
        findViewById(R.id.opentoolhttp).setOnClickListener(clickListener);
    }
}
